Description of project:
Project Overview
For our final Operations Research project, our team developed a stock portfolio optimization system designed to help investors allocate money across a limited number of stocks while balancing expected return and financial risk. Using historical monthly stock price data for 120 publicly traded companies, we built and tested an optimization model that determines how much of a portfolio should be invested in each selected stock.
The intended purpose of the project was to demonstrate how mathematical optimization can support real-world financial decision-making under uncertainty. Instead of relying on intuition or simple diversification, our system uses mathematical modeling to recommend an optimal investment strategy based on historical performance and risk behavior.
## Industrial Engineering Context
This project is grounded in Operations Research and Industrial Engineering optimization principles, specifically the Markowitz Mean-Variance Portfolio Optimization Model. The project applied key IE concepts such as optimization under constraints, risk modeling using variance and covariance, data-driven system design, and mathematical decision-making under uncertainty. This project demonstrated how theoretical IE models can be transformed into practical tools for financial decision-making.
## Skills Used & Developed
Throughout this project, I developed and strengthened the following skills:
- Operations Research modeling
- Mathematical optimization
- Financial data analysis
- Statistical risk measurement
- AMPL model formulation and solver implementation
- Data cleaning and parameter processing
- Constraint design (cardinality & linking constraints)
- Debugging optimization models
- Team collaboration and technical communication
- Translating mathematical theory into real-world systems
# Project Development Process
## Original Idea & Goal
Our original goal was to create a system that could intelligently allocate investments across multiple stocks while minimizing financial risk. We wanted a project that connected Operations Research to a real-world application, and the stock market provided an ideal system due to its uncertainty, complexity, and real financial impact. We selected the Markowitz Mean-Variance Model as our foundation because it balances expected return and portfolio risk.
## Data Collection & Preparation
We collected monthly closing stock prices for 120 different stocks dating back to 2015 using Python financial data tools and exported this data into Excel. From this raw price data, we calculated monthly return values using:
r_t = (p_t - p_(t-1)) / p_(t-1)
Next, we generated a covariance matrix using Excel’s COVARIANCE.S function. This matrix measures how stocks move relative to each other and is essential for calculating portfolio risk. To test real-world performance later, we cut the dataset to end on 12/1/2024. All processed return and covariance values were exported into a text file and imported into AMPL for optimization.
## Base Model Design (Markowitz Optimization)
We implemented the classical Markowitz Mean-Variance Optimization model in AMPL using:
Decision Variable:
- x_i = portion of the portfolio invested in stock i
Objective:
- Minimize total portfolio variance (risk)
Constraints:
- Full investment: all weights sum to 1
- Minimum required expected return
- No short selling: all values must be nonnegative
Although this base model successfully minimized risk, it spread investment across over 100 stocks, producing portfolios that were mathematically optimal but unrealistic for real investors.
## Model Evolution & Improvements
### Time-Weighted Expected Returns
Instead of using raw historical averages, we divided stock return data into three time blocks:
- Oldest 48 months → 10% weight
- Middle 48 months → 30% weight
- Most recent 24 months → 60% weight
This ensured that recent stock performance had the greatest influence, preventing outdated trends from misleading the model.
### Cardinality Constraint (Portfolio Size Control)
We added a binary decision variable:
- y_i = 1 if stock i is selected
- y_i = 0 otherwise
We then added the constraint:
Sum(y_i) ≤ 10
This restricted the portfolio to 10 stocks, making the solution realistic, easier to manage, and more cost-efficient by reducing excessive transaction fees.
## Roadblocks & Challenges
We faced several technical and logistical challenges including importing large datasets into AMPL, debugging solver feasibility issues, managing sensitivity in the covariance matrix, and properly linking binary and continuous variables. These challenges forced us to refine our model structure and test multiple variations before arriving at a stable solution.
## Final Results & Performance Testing
After finalizing the model, we ran multiple optimization tests under different minimum return requirements. The extended model consistently achieved lower risk with only 10 stocks. To test real-world performance, we simulated a $10,000,000 investment starting on 12/1/2024. After 11 months, the optimized portfolio produced a 17.53% realized return, resulting in a $1,753,000 profit. This confirmed that the model was not only mathematically sound, but also effective under real market conditions.
## Did the Final Project Match Our Expectations?
While the core goal remained the same, the project evolved significantly. Originally, we expected to stop with the base Markowitz model. However, once we saw that the base model produced unrealistic portfolios, we shifted focus toward practical feasibility. The addition of weighted returns and the cardinality constraint transformed the project into a much more realistic and professional-grade optimization system.